#include "rapidxml.hpp"
#include <iostream>

using namespace rapidxml;

using namespace std;

int main(int argc , char ** argv){
    char txt[] = {"<html><head></head><body><form  action=\"\"><input name=\"\" type=\"text\" /><input type=\"submit\"/></form></body></html>"};
     
    /*memset(txt,0,1024);
    memcpy(txt,"<html><head></head><body><form  action=\"\"><input name=\"\" type=\"text\" /><input type=\"submit\"/></form></body></html>",1024);

    memset(nn,0,5); 
    memcpy(nn,"form",5);*/

    //printf("txt:%s nn:%s\n",txt,nn);
    
    xml_document<> doc;
    doc.parse<0>(txt); 
    xml_node<> * root = doc.first_node("html");

    if (root) {
        xml_node<> *sub_node = root->first_node();
        if (sub_node) {
		printf("the node is %s\n", sub_node->name());
	}
    }
    printf("the first node name:%s\n",root->name()); 
    //xml_node<> *node2 = doc.first_node("form");
    //printf("the first input node:%s\n",node2->name());

   /*xml_node<> *node = root->first_node(nn);
   cout << "Node foobar has value " << node->value() << "\n";
   for (xml_attribute<> *attr = node->first_attribute();
     attr; attr = attr->next_attribute())
   {
    cout << "Node foobar has attribute " << attr->name() << " ";
    cout << "with value " << attr->value() << "\n";
   }*/
   // std::cout<< txt << std::endl;    
}
